﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:Berico="clr-namespace:SilverlightCenusValidator.Berico"
    >
    
    <!-- Default style for Berico.Windows.Controls.Slider -->
    <Style TargetType="Berico:Slider">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="LowerRangeValue" Value="2" />
        <Setter Property="UpperRangeValue" Value="8" />
        <Setter Property="Maximum" Value="10" />
        <Setter Property="Minimum" Value="0" />
        <Setter Property="Value" Value="5" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Berico:Slider">
                    <Grid x:Name="LayoutRoot">
                        <Grid.Resources>
                            <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
                                <Grid x:Name="LayoutRoot" Opacity="0" Background="Transparent"/>
                            </ControlTemplate>
                            <ControlTemplate x:Key="FillThumbTemplate" TargetType="Thumb">
                                <Grid x:Name="LayoutRoot">
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                            <vsm:VisualState x:Name="Normal"/>
                                            <vsm:VisualState x:Name="MouseOver"/>
                                            <vsm:VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="Visibility" Duration="0">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Visibility>Visible</Visibility>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>

                                    <Rectangle Stroke="#FFA3AEB9" Fill="Blue" />
                                    <Rectangle x:Name="DisabledOverlay" Visibility="Collapsed" Opacity=".55" Stroke="#FFA3AEB9" Fill="White" />
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver"/>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbDisabledOverlay" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>-->
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- ToolTip -->
                        <Popup x:Name="ValueTipPopup" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Grid x:Name="ValueTipPopupRoot" Height="Auto" Width="Auto">
                                <Border Padding="0,0,0,0" Margin="0,0,2,2" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Background="White" BorderBrush="#FF000000" BorderThickness="1,1,1,1">
                                    <TextBlock x:Name="ValueTipTextBlock" Margin="2" FontSize="10">
                                        <TextBlock.RenderTransform>
                                            <TransformGroup>
                                                <RotateTransform x:Name="ValueTipRotateTransform" Angle="0" />
                                            </TransformGroup>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                </Border>
                            </Grid>
                        </Popup>

                        <!-- Horizontal Template -->
                        <Grid x:Name="HorizontalTemplate">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <RepeatButton x:Name="HorizontalDecreaseHandle" Grid.Column="0" Margin="0,0,2,0" Height="15" Width="15" FontSize="9" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" Content="-" />
                            <Grid x:Name="HorizontalSingleThumbTemplate" Grid.Column="1" Background="{TemplateBinding Background}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <!-- Track Layer -->
                                <Rectangle x:Name="HorizontalSingleThumbTrackRectangle" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" Fill="#FFE6EFF7" Grid.Column="0" Grid.ColumnSpan="3" Height="3" RadiusX="1" RadiusY="1" Margin="5,0,5,0" />
                                <Rectangle x:Name="HorizontalTrackRectangleDisabledOverlay" Visibility="Collapsed"  Fill="White" Opacity=".55" Grid.Column="0" Grid.ColumnSpan="3" Height="3" RadiusX="1" RadiusY="1" Margin="5,0,5,0" />
                                
                                <!-- Repeat Buttons + Thumb -->
                                <RepeatButton x:Name="HorizontalSingleThumbLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="0"/>
                                <Thumb Height="18" x:Name="HorizontalThumb" Width="11" Grid.Column="1" IsTabStop="True"/>
                                <!--<Rectangle x:Name="HorizontalSingleThumbDisabledOverlay" RadiusX="2" RadiusY="2"  Width="11" Grid.Column="1" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->
                                <RepeatButton x:Name="HorizontalSingleThumbLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="2"/>
                            </Grid>
                            <Grid x:Name="HorizontalRangeTemplate" Grid.Column="1" Background="{TemplateBinding Background}" Visibility="Collapsed">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <!-- Track Layer -->
                                <Rectangle x:Name="HorizontalRangeTrackRectangle" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" Fill="#FFE6EFF7" Grid.Column="0" Grid.ColumnSpan="5" Height="3" RadiusX="1" RadiusY="1" Margin="5,0,5,0"/>

                                <!-- Repeat Buttons + Thumb (Lower) -->
                                <RepeatButton x:Name="HorizontalRangeLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="0"/>
                                <Thumb x:Name="HorizontalLowerThumb" Width="11" Height="18" Grid.Column="1" IsTabStop="True" />
                                <!--<Rectangle x:Name="HorizontalLowerThumbDisabledOverlay" RadiusX="2" RadiusY="2" Width="11" Grid.Column="1" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->

                                <!-- Track Filler:  Represents the actual range -->
                                <Thumb x:Name="HorizontalRangeThumb" Template="{StaticResource FillThumbTemplate}" Grid.Column="2" Height="3" />
                                <!--<Rectangle x:Name="HorizontalRangeThumbDisabledOverlay" Height="3" Grid.Column="2" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->

                                <!-- Repeat Buttons + Thumb (Upper) -->
                                <Thumb x:Name="HorizontalUpperThumb" Width="11" Height="18" Grid.Column="3" IsTabStop="True" />
                                <!--<Rectangle x:Name="HorizontalUpperThumbDisabledOverlay" RadiusX="2" RadiusY="2" Width="11" Grid.Column="3" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->

                                <RepeatButton x:Name="HorizontalRangeLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="4"/>
                            </Grid>
                            <RepeatButton x:Name="HorizontalIncreaseHandle" Height="15" Width="15" IsTabStop="False" Grid.Column="2" Margin="2,0,0,0" FontSize="9" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="+" />
                        </Grid>
                        
                        <!-- Vertical Template -->
                        <Grid x:Name="VerticalTemplate" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <RepeatButton x:Name="VerticalDecreaseHandle" Grid.Row="2" Margin="0,2,0,0" Height="15" Width="15" FontSize="9" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" Content="-" />
                            <Grid x:Name="VerticalSingleThumbTemplate" Grid.Row="1" Background="{TemplateBinding Background}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <!-- Track Layer -->
                                <Rectangle x:Name="VerticalSingleThumbTrackRectangle" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" Fill="#FFE6EFF7" Grid.Row="0" Grid.RowSpan="3" Width="3" RadiusX="1" RadiusY="1" Margin="0,5,0,5" />
                                <Rectangle x:Name="VerticalTrackRectangleDisabledOverlay" Visibility="Collapsed"  Fill="White" Opacity=".55" Grid.Row="0" Grid.RowSpan="3" Width="3" RadiusX="1" RadiusY="1" Margin="0,5,0,5" />

                                <!-- Repeat Buttons + Thumb -->
                                <RepeatButton x:Name="VerticalSingleThumbLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="2"/>
                                <Thumb Height="11" x:Name="VerticalThumb" Width="18" Grid.Row="1" IsTabStop="True"/>
                                <RepeatButton x:Name="VerticalSingleThumbLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="0"/>
                            </Grid>
                            <Grid x:Name="VerticalRangeTemplate" Grid.Row="1" Background="{TemplateBinding Background}" Visibility="Collapsed">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <!-- Track Layer -->
                                <Rectangle x:Name="VerticalRangeTrackRectangle" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" Fill="#FFE6EFF7" Grid.Row="0" Grid.RowSpan="5" Width="3" RadiusX="1" RadiusY="1" Margin="0,5,0,5" />

                                <!-- Repeat Buttons + Thumb (Lower) -->
                                <RepeatButton x:Name="VerticalRangeLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="4"/>
                                <Thumb x:Name="VerticalLowerThumb" Width="18" Height="11" Grid.Row="3" IsTabStop="True" />
                                <!--<Rectangle x:Name="VerticalLowerThumbDisabledOverlay" RadiusX="2" RadiusY="2" Width="11" Grid.Row="31" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->

                                <!-- Track Filler:  Represents the actual range -->
                                <Thumb x:Name="VerticalRangeThumb" Template="{StaticResource FillThumbTemplate}" Grid.Row="2" Width="3" />
                                <!--<Rectangle x:Name="VerticalRangeThumbDisabledOverlay" Width="3" Grid.Row="2" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->

                                <!-- Repeat Buttons + Thumb (Upper) -->
                                <Thumb x:Name="VerticalUpperThumb" Width="18" Height="11" Grid.Row="1" IsTabStop="True" />
                                <!--<Rectangle x:Name="VerticalUpperThumbDisabledOverlay" RadiusX="2" RadiusY="2" Width="11" Grid.Row="1" Fill="White" Opacity=".55" Visibility="Collapsed"/>-->
                                <RepeatButton x:Name="VerticalRangeLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="0"/>

                            </Grid>
                            <RepeatButton x:Name="VerticalIncreaseHandle" Height="15" Width="15" IsTabStop="False" Grid.Row="0" Margin="0,2,0,0" FontSize="9" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="+" />
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>
